<!--
* description: 案例-案例评审
* author: hzm
* createdDate: 2021-2-25
-->
<template>
  <div class="app-container app-container-table">
    <one-table-template
      ref="multipleTable"
      :dynamic-buttons="tableButtons"
      :dynamic-components="tableComponents"
      :dynamic-api-config="dynamicApiConfigs"
      :dynamic-table-cols="tableCols"
      :dynamic-form-fields="formField"
      :dynamic-is-show-select="false"
      :dynamic-is-init-table="true"
      :dynamic-is-fix-choose="false"
      :dynamic-is-fix-index="false"
      :dynamic-api-style="'restful'"
    />
    <caseReviewList
      :dialogVisible = "dialogVisible"
      @close="close"
    />
  </div>
</template>

<script>
import { formMixins } from "@/components/mixins/formMixins";
import { oneTableWithViewTemplateMixins } from "@/components/mixins/oneTableWithViewTemplateMixins";
import OneTableTemplate from "@/components/templates/oneTable";
import api from "@/api/vehicleManagement";

export default {
  name: "caseReview",
  components: {
    OneTableTemplate,
    CaseReviewList: () => import('./edit')
  },
  mixins: [oneTableWithViewTemplateMixins, formMixins],
  data() {
    return {
      dialogVisible: false,
      dynamicApiConfigs: api.inventoryQuery,
      // 动态生成网格列
      tableCols:
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path] &&
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path].tableCols &&
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path].tableCols
          .length > 0
          ? this.$ConfigCache.CacheConfig.cacheData[this.$route.path].tableCols
          : [
              {
                prop: "controlBtn",
                label: "操作", // 操作
                codeField: "controlBtn",
                width: 100,
                align: "center",
                isComponent: true,
                comps: [
                  {
                    compKey: "propKey1",
                    labelName: "详情", // 编辑
                    align: "center",
                    codeField: "editControlBtn",
                    clickEvent: (index) => {
                      this.dialogVisible = true
                    },
                    component: () => import("@/components/org/linkButton"),
                  },
                ],
              },
              {
                prop: "vin",
                label: "申请单号",
                align: "center",
              },
              {
                prop: "moveStateCn",
                label: "门店编号",
                align: "center",
              },
              {
                prop: "isCarState",
                label: "门店名称",
                align: "center",
              },
              {
                prop: "hostLimitrEasonCn",
                label: "申请日期",
                align: "center",
              },
              {
                prop: "assignState",
                label: "主题",
                align: "center",
              },
              {
                prop: "hostQualityStateCn",
                label: "回复人",
                align: "center",
              },
              {
                prop: "assignDate",
                label: "状态",
                align: "center",
              },
              {
                prop: "lastInStockDate",
                label: "关闭日期",
                align: "center",
              },
              {
                prop: "carHouseName",
                label: "备注",
                align: "center",
              }
            ],
      tableComponents:
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path] &&
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path]
          .tableComponents &&
        this.$ConfigCache.CacheConfig.cacheData[this.$route.path]
          .tableComponents.length > 0
          ? this.$ConfigCache.CacheConfig.cacheData[this.$route.path]
              .tableComponents
          : [
              // 库存状态
              {
                compKey: "compKey1",
                labelName: "申请单号：",
                codeField: "moveState",
                lookuptype: "VE0212",
                component: () => import("@/components/org/commonInput"),
                type: "inputText",
                isMust: true,
                span: 6,
              },
              // 车辆状态
              {
                compKey: "compKey2",
                labelName: "门店编号：",
                codeField: "isCarState",
                lookuptype: "VE0207",
                component: () => import("@/components/org/commonInput"),
                type: "inputText",
                isMust: true,
                span: 6,
              },
              // 入库仓库
              {
                compKey: "compKey3",
                labelName: "门店名称：",
                codeField: "carStockHouseId",
                component: () => import("@/components/org/commonInput"),
                type: "inputText",
                isMust: true,
                span: 6,
              },
              // 审核状态
              {
                compKey: "compKey4",
                labelName: "申请日期：",
                codeField: "assignState",
                component: () => import("@/components/org/datePicker/andtDatePicker"),
                type: "inputText",
                isMust: true,
                span: 6,
              },
              // VIN码
              {
                compKey: "compKey5",
                labelName: "主题：",
                codeField: "vin",
                component: () => import("@/components/org/commonInput"),
                type: "inputText",
                isMust: false,
                span: 6,
              },
              // 质量状态
              {
                compKey: "compKey7",
                labelName: "回复人：",
                codeField: "hostQualityState",
                lookuptype: "VE0268",
                component: () => import("@/components/org/commonInput"),
                type: "dropdownList",
                isMust: false,
                span: 6,
              },
              {
                compKey: "compKey6",
                labelName: "回复日期：",
                codeField: "lastInStockDate",
                component: () =>
                  import("@/components/org/datePicker/andtDatePicker"),
                type: "inputText",
                isMust: false,
                span: 6,
              },
              // 车辆类型
              {
                compKey: "compKey8",
                labelName: "状态：",
                codeField: "hostLimitState",
                lookuptype: "VE1033",
                component: () => import("@/components/org/commonInput"),
                type: "dropdownList",
                isMust: false,
                span: 6,
              },
            ],
      tableButtons: [
        {
          conmpKey: "btenKey1",
          type: "primary",
          size: "small",
          text: "查询",
          name: 'search',
          clickEvent: () => this.queryTable(1),
          position: "right",
        },
        {
          conmpKey: "btenKey2",
          type: "",
          size: "small",
          text: "重置",
          name: 'reset',
          clickEvent: () => this.reset(),
          position: "right",
        },
      ],
      formField: this.$utils.getFormField(this, {
        moveState: "",
        isCarState: "",
        carStockHouseId: "",
        assignState: "",
        vin: "",
        lastInStockDate: "",
        hostQualityState: "",
        hostLimitState: "",
      }),
    };
  },
  methods: {
      close() {
        this.dialogVisible = false
      }
  },
  mounted() {
    // this.queryTable(1)
    this.$refs.multipleTable.list = [{
      index: 1
    }]
  },
};
</script>

<style>
</style>
